<?php

namespace Biz\model\springHomeDecActivity;

use Biz\pockets\modelTrait\BizModelTrait;
use Biz\service\springHomeDecActivity\Util;
use Doraemon\pockets\datebase\BaseDbModel;

class ActivityContent extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_store';

    const _CONFIG_SELECT_ = 'db_brand_activity';

    const _DATABASE_ = 'brand_activity';

    const _TABLE_NAME = 'spring_home_dec_content';


    const IS_SHOW_YES = 1; //展示
    const IS_SHOW_NO = 0; //不展示

    const IS_TEST_YES = 1; //测试
    const IS_TEST_NO = 0; //默认

    const TYPE_NOTE = 0;  //note
    const TYPE_ARTICLE = 1;  //整屋


    //删除字段名称
    protected static $deleteField = 'data_status';


    use BizModelTrait;


    /**
     * 获取主题内容
     * @param $topicId
     * @param $date
     * @return array
     */
    public static function getContents($topicId,$date)
    {
        $contents = [];
        $where['data_status'] = self::STATUS_NORMAL;
        $where['topic_id'] = $topicId;
        $where['show_date'] = $date;
        $where['is_test'] = Util::isTest();
        $where['is_show'] = self::IS_SHOW_YES;
        $where['ORDER'] = ['weight' => 'ASC'];
        $result = self::dataSelect($where);
        if ($result && is_array($result)) {
            $contents = $result;
        }
        return $contents;
    }
}
